#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N=1010;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
int n;
int a[N], f[N];

int main()
{
	close();
    cin>>n;
    for (int i = 1; i <= n; i ++ ) cin>>a[i];

    for (int i = 1; i <= n; i ++ )
    {
        f[i] = 1; // 只有a[i]一个数
        for (int j = 1; j < i; j ++ )
            if (a[j] < a[i])
                f[i] = max(f[i], f[j] + 1);
    }

    int ans = 0;
    for (int i = 1; i <= n; i ++ ) ans = max(ans, f[i]);

    cout<<ans<<'\n';

    return 0;
}
